from redis import StrictRedis
import redis
import logging


class Config(object):
    """项目配置信息"""
    DEBUG = True

    # 数据库
    SQLALCHEMY_DATABASE_URI = "mysql://root:mysql@127.0.0.1:3306/liulian"
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # redis配置
    REDIS_HOST = "127.0.0.1"
    REDIS_PORT="6379"

    # session
    SECRET_KEY = "23456789WERTYUIOWERTYUI"
    SESSION_TYPE = "redis"
    SESSION_USE_SIGNER = True
    SESSION_REDIS = redis.StrictRedis(host=REDIS_HOST,port=REDIS_PORT)
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopementConfig(Config):
    """开发模式下的配置"""
    DEBUG = True

    LOG_LEVEL = logging.DEBUG

class ProductionConfig(Config):
    """上线环境下"""
    DEBUG = False

    LOG_LEVEL = logging.DEBUG


config_dict = {
    "development":DevelopementConfig,
    "production":ProductionConfig
}